#import <Cocoa/Cocoa.h>

extern NSString *BWLayer_ChangeNotification;

typedef enum {
    kLayerKind_NoKind,
    kLayerKind_CrossStitch,
    kLayerKind_BackStitch,
    kLayerKind_Selection,
    kLayerKind_Grid

} BWLayerKind;

@class BWGridGeometry;

@interface BWLayer : NSObject <NSCoding>
{
    BWGridGeometry *geometry;
    NSString *name;
    BOOL visible;
    BOOL active;
    
    BWLayer *nextHigherLayer;
}

- (void) setNextHigherLayer: (BWLayer *) layer;

- (NSRect) bounds;

- (void) setGeometry: (BWGridGeometry *) geometry;
- (BWGridGeometry *) geometry;

- (void) drawRect: (NSRect) rect;

- (void) setName: (NSString *) string;
- (NSString *) name;

- (void) setVisible: (BOOL) onOff;
- (BOOL) visible;

- (void) setActive: (BOOL) onOff;
- (BOOL) active;

- (BWLayerKind) layerKind;

@end // BWLayer

// stuff mainly of use to subclasses

@interface BWLayer(LayerContentVisibility)

// layers return NO if they're planning on drawing to that location

- (BOOL) okToRenderRow: (int) row
                column: (int)column;

@end // LayerContentVisiblity


@interface BWLayer(LayerEventHandling)

- (BOOL) handleMouseDown: (NSEvent *) event
                 atPoint: (NSPoint) mouse;
- (void) handleMouseDragged: (NSEvent *) event
                    atPoint: (NSPoint) mouse;
- (void) handleMouseUp: (NSEvent *) event
               atPoint: (NSPoint) mouse;

@end // LayerEventHandling


@interface BWLayer(LayerNotification)

- (void) postChangeNotification;

@end // LayerNotification

